﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace SaaSKit.Taskr.Service
{
    [DataContract(Namespace = "SaaSKit.Taskr", Name = "Task")]
    public class TaskDTO
    {
        [DataMember(Name = "Id")]
        public Guid Id { get; set; }

        [DataMember(Name = "CreatedDate")]
        public DateTime CreatedDate { get; set; }

        [DataMember(Name = "DueDate")]
        public DateTime? DueDate { get; set; }

        [DataMember(Name = "CompletedDate")]
        public DateTime? CompletedDate { get; set; }

        [DataMember(Name = "AssigneeId")]
        public Guid? AssigneeId { get; set; }

        [DataMember(Name = "Status")]
        public string Status { get; set; }

        [DataMember(Name = "Summary")]
        public string Summary { get; set; }

        [DataMember(Name = "Description")]
        public string Description { get; set; }

        [DataMember(Name = "ActivityHistory")]
        public IList<ActivityDTO> ActivityHistory { get; set; }

        public override string ToString()
        {
            return string.Format
            (
                "Id: '{0}'\nCreatedDate: '{1}'\nDueDate: '{2}'\nCompletedDate: '{3}'\nAssigneeId: '{4}'\nStatus: '{5}'\nSummary: '{6}'\nActivity History (size): '{7}'\nDescription: '{8}'\n",
                Id, CreatedDate, DueDate, CompletedDate, AssigneeId, Status, Summary, ActivityHistory == null ? 0 : ActivityHistory.Count, Description
            );
        }
    }
}
